using System;
using System.Runtime.InteropServices;
using System.Text;

namespace Next.Whs.MQ
{
	internal struct Constants
	{
		// get message match option constants
		public const uint MQRL_UNDEFINED = 0xffffffff;
		public const uint MQMO_MATCH_MSG_ID = 0x00000001;
		public const uint MQMO_MATCH_CORREL_ID = 0x00000002;
		public const uint MQMO_MATCH_GROUP_ID = 0x00000004;
		public const uint MQMO_MATCH_MSG_SEQ_NUMBER = 0x00000008;
		public const uint MQMO_MATCH_OFFSET = 0x00000010;
		public const uint MQMO_MATCH_MSG_TOKEN = 0x00000020;
		public const uint MQMO_NONE = 0x00000000;
		public const byte MQGS_NOT_IN_GROUP = (byte)' ';
		public const byte MQGS_LAST_MSG_IN_GROUP = (byte)';';
		public const byte MQSS_NOT_A_SEGMENT = (byte)' ';
		public const byte MQSS_SEGMENT = (byte)'S';
		public const byte MQSS_LAST_SEGMENT = (byte)';';
		public const byte MQSEG_INHIBITED = (byte)' ';
		public const byte MQSEG_ALLOWED = (byte)'A';
		// get message constants
		public const uint MQGMO_VERSION_1 = 1;
		public const uint MQGMO_VERSION_2 = 2;
		public const uint MQGMO_VERSION_3 = 3;
		public const uint MQGMO_CURRENT_VERSION = 3;
		public const uint MQGMO_WAIT = 0x00000001;
		public const uint MQGMO_NO_WAIT = 0x00000000;
		public const uint MQGMO_SYNCPOINT = 0x00000002;
		public const uint MQGMO_SYNCPOINT_IF_PERSISTENT = 0x00001000;
		public const uint MQGMO_NO_SYNCPOINT = 0x00000004;
		public const uint MQGMO_MARK_SKIP_BACKOUT = 0x00000080;
		public const uint MQGMO_BROWSE_FIRST = 0x00000010;
		public const uint MQGMO_BROWSE_NEXT = 0x00000020;
		public const uint MQGMO_BROWSE_MSG_UNDER_CURSOR = 0x00000800;
		public const uint MQGMO_MSG_UNDER_CURSOR = 0x00000100;
		public const uint MQGMO_LOCK = 0x00000200;
		public const uint MQGMO_UNLOCK = 0x00000400;
		public const uint MQGMO_ACCEPT_TRUNCATED_MSG = 0x00000040;
		public const uint MQGMO_SET_SIGNAL = 0x00000008;
		public const uint MQGMO_FAIL_IF_QUIESCING = 0x00002000;
		public const uint MQGMO_CONVERT = 0x00004000;
		public const uint MQGMO_LOGICAL_ORDER = 0x00008000;
		public const uint MQGMO_COMPLETE_MSG = 0x00010000;
		public const uint MQGMO_ALL_MSGS_AVAILABLE = 0x00020000;
		public const uint MQGMO_ALL_SEGMENTS_AVAILABLE = 0x00040000;
		public const uint MQGMO_NONE = 0x00000000;
		// message format constants
		public const uint MQMD_VERSION_1 = 1;
		public const uint MQMD_VERSION_2 = 2;
		public const uint MQMD_CURRENT_VERSION = 2;
		public const uint MQRO_EXCEPTION = 0x01000000;
		public const uint MQRO_EXCEPTION_WITH_DATA = 0x03000000;
		public const uint MQRO_EXCEPTION_WITH_FULL_DATA = 0x07000000;
		public const uint MQRO_EXPIRATION = 0x00200000;
		public const uint MQRO_EXPIRATION_WITH_DATA = 0x00600000;
		public const uint MQRO_EXPIRATION_WITH_FULL_DATA = 0x00e00000;
		public const uint MQRO_COA = 0x00000100;
		public const uint MQRO_COA_WITH_DATA = 0x00000300;
		public const uint MQRO_COA_WITH_FULL_DATA = 0x00000700;
		public const uint MQRO_COD = 0x00000800;
		public const uint MQRO_COD_WITH_DATA = 0x00001800;
		public const uint MQRO_COD_WITH_FULL_DATA = 0x00003800;
		public const uint MQRO_PAN = 0x00000001;
		public const uint MQRO_NAN = 0x00000002;
		public const uint MQRO_NEW_MSG_ID = 0x00000000;
		public const uint MQRO_PASS_MSG_ID = 0x00000080;
		public const uint MQRO_COPY_MSG_ID_TO_CORREL_ID = 0x00000000;
		public const uint MQRO_PASS_CORREL_ID = 0x00000040;
		public const uint MQRO_DEAD_LETTER_Q = 0x00000000;
		public const uint MQRO_DISCARD_MSG = 0x08000000;
		public const uint MQRO_NONE = 0x00000000;
		public const uint MQRO_REJECT_UNSUP_MASK = 0x101c0000;
		public const uint MQRO_ACCEPT_UNSUP_MASK = 0xefe000ff;
		public const uint MQRO_ACCEPT_UNSUP_IF_XMIT_MASK = 0x0003ff00;
		public const uint MQMT_SYSTEM_FIRST = 1;
		public const uint MQMT_REQUEST = 1;
		public const uint MQMT_REPLY = 2;
		public const uint MQMT_DATAGRAM = 8;
		public const uint MQMT_REPORT = 4;
		public const uint MQMT_MQE_FIELDS_FROM_MQE = 112;
		public const uint MQMT_MQE_FIELDS = 113;
		public const uint MQMT_SYSTEM_LAST = 65535;
		public const uint MQMT_APPL_FIRST = 65536;
		public const uint MQMT_APPL_LAST = 999999999;
		public const uint MQEI_UNLIMITED = 0xffffffff;
		public const uint MQFB_NONE = 0;
		public const uint MQFB_SYSTEM_FIRST = 1;
		public const uint MQFB_QUIT = 256;
		public const uint MQFB_EXPIRATION = 258;
		public const uint MQFB_COA = 259;
		public const uint MQFB_COD = 260;
		public const uint MQFB_CHANNEL_COMPLETED = 262;
		public const uint MQFB_CHANNEL_FAIL_RETRY = 263;
		public const uint MQFB_CHANNEL_FAIL = 264;
		public const uint MQFB_APPL_CANNOT_BE_STARTED = 265;
		public const uint MQFB_TM_ERROR = 266;
		public const uint MQFB_APPL_TYPE_ERROR = 267;
		public const uint MQFB_STOPPED_BY_MSG_EXIT = 268;
		public const uint MQFB_XMIT_Q_MSG_ERROR = 271;
		public const uint MQFB_PAN = 275;
		public const uint MQFB_NAN = 276;
		public const uint MQFB_STOPPED_BY_CHAD_EXIT = 277;
		public const uint MQFB_STOPPED_BY_PUBSUB_EXIT = 279;
		public const uint MQFB_NOT_A_REPOSITORY_MSG = 280;
		public const uint MQFB_BIND_OPEN_CLUSRCVR_DEL = 281;
		public const uint MQFB_DATA_LENGTH_ZERO = 291;
		public const uint MQFB_DATA_LENGTH_NEGATIVE = 292;
		public const uint MQFB_DATA_LENGTH_TOO_BIG = 293;
		public const uint MQFB_BUFFER_OVERFLOW = 294;
		public const uint MQFB_LENGTH_OFF_BY_ONE = 295;
		public const uint MQFB_IIH_ERROR = 296;
		public const uint MQFB_NOT_AUTHORIZED_FOR_IMS = 298;
		public const uint MQFB_IMS_ERROR = 300;
		public const uint MQFB_IMS_FIRST = 301;
		public const uint MQFB_IMS_LAST = 399;
		public const uint MQFB_CICS_INTERNAL_ERROR = 401;
		public const uint MQFB_CICS_NOT_AUTHORIZED = 402;
		public const uint MQFB_CICS_BRIDGE_FAILURE = 403;
		public const uint MQFB_CICS_CORREL_ID_ERROR = 404;
		public const uint MQFB_CICS_CCSID_ERROR = 405;
		public const uint MQFB_CICS_ENCODING_ERROR = 406;
		public const uint MQFB_CICS_CIH_ERROR = 407;
		public const uint MQFB_CICS_UOW_ERROR = 408;
		public const uint MQFB_CICS_COMMAREA_ERROR = 409;
		public const uint MQFB_CICS_APPL_NOT_STARTED = 410;
		public const uint MQFB_CICS_APPL_ABENDED = 411;
		public const uint MQFB_CICS_DLQ_ERROR = 412;
		public const uint MQFB_CICS_UOW_BACKED_OUT = 413;
		public const uint MQFB_SYSTEM_LAST = 65535;
		public const uint MQFB_APPL_FIRST = 65536;
		public const uint MQFB_APPL_LAST = 999999999;
		public const uint MQENC_NATIVE = 0x00000222;
		public const uint MQENC_INTEGER_MASK = 0x0000000f;
		public const uint MQENC_DECIMAL_MASK = 0x000000f0;
		public const uint MQENC_FLOAT_MASK = 0x00000f00;
		public const uint MQENC_RESERVED_MASK = 0xfffff000;
		public const uint MQENC_INTEGER_UNDEFINED = 0x00000000;
		public const uint MQENC_INTEGER_NORMAL = 0x00000001;
		public const uint MQENC_INTEGER_REVERSED = 0x00000002;
		public const uint MQENC_DECIMAL_UNDEFINED = 0x00000000;
		public const uint MQENC_DECIMAL_NORMAL = 0x00000010;
		public const uint MQENC_DECIMAL_REVERSED = 0x00000020;
		public const uint MQENC_FLOAT_UNDEFINED = 0x00000000;
		public const uint MQENC_FLOAT_IEEE_NORMAL = 0x00000100;
		public const uint MQENC_FLOAT_IEEE_REVERSED = 0x00000200;
		public const uint MQENC_FLOAT_S390 = 0x00000300;
		public const uint MQCCSI_UNDEFINED = 0;
		public const uint MQCCSI_DEFAULT = 0;
		public const uint MQCCSI_Q_MGR = 0;
        public const uint MQCCSI_ISO8859 = 819;
		public const uint MQPRI_PRIORITY_AS_Q_DEF = 0xffffffff;
		public const uint MQPER_NOT_PERSISTENT = 0;
		public const uint MQPER_PERSISTENT = 1;
		public const uint MQPER_PERSISTENCE_AS_Q_DEF = 2;
		public const uint MQAT_UNKNOWN = 0xffffffff;
		public const uint MQAT_NO_CONTEXT = 0;
		public const uint MQAT_CICS = 1;
		public const uint MQAT_MVS = 2;
		public const uint MQAT_OS390 = 2;
		public const uint MQAT_IMS = 3;
		public const uint MQAT_OS2 = 4;
		public const uint MQAT_DOS = 5;
		public const uint MQAT_AIX = 6;
		public const uint MQAT_UNIX = 6;
		public const uint MQAT_QMGR = 7;
		public const uint MQAT_OS400 = 8;
		public const uint MQAT_WINDOWS = 9;
		public const uint MQAT_CICS_VSE = 10;
		public const uint MQAT_WINDOWS_NT = 11;
		public const uint MQAT_VMS = 12;
		public const uint MQAT_GUARDIAN = 13;
		public const uint MQAT_NSK = 13;
		public const uint MQAT_VOS = 14;
		public const uint MQAT_IMS_BRIDGE = 19;
		public const uint MQAT_XCF = 20;
		public const uint MQAT_CICS_BRIDGE = 21;
		public const uint MQAT_NOTES_AGENT = 22;
		public const uint MQAT_BROKER = 26;
		public const uint MQAT_JAVA = 28;
		public const uint MQAT_DQM = 29;
		public const uint MQAT_DEFAULT = 11;
		public const uint MQAT_USER_FIRST = 65536;
		public const uint MQAT_USER_LAST = 999999999;
		public const uint MQMF_SEGMENTATION_INHIBITED = 0x00000000;
		public const uint MQMF_SEGMENTATION_ALLOWED = 0x00000001;
		public const uint MQMF_MSG_IN_GROUP = 0x00000008;
		public const uint MQMF_LAST_MSG_IN_GROUP = 0x00000010;
		public const uint MQMF_SEGMENT = 0x00000002;
		public const uint MQMF_LAST_SEGMENT = 0x00000004;
		public const uint MQMF_NONE = 0x00000000;
		public const uint MQMF_REJECT_UNSUP_MASK = 0x00000fff;
		public const uint MQMF_ACCEPT_UNSUP_MASK = 0xfff00000;
		public const uint MQMF_ACCEPT_UNSUP_IF_XMIT_MASK = 0x000ff000;
		public const uint MQOL_UNDEFINED = 0xffffffff;
		public const uint MQPMO_VERSION_1 = 1;
		public const uint MQPMO_VERSION_2 = 2;
		public const uint MQPMO_CURRENT_VERSION = 2;
		public const uint MQPMO_CURRENT_LENGTH = 152;
		public const uint MQPMO_SYNCPOINT = 0x00000002;
		public const uint MQPMO_NO_SYNCPOINT = 0x00000004;
		public const uint MQPMO_NEW_MSG_ID = 0x00000040;
		public const uint MQPMO_NEW_CORREL_ID = 0x00000080;
		public const uint MQPMO_LOGICAL_ORDER = 0x00008000;
		public const uint MQPMO_NO_CONTEXT = 0x00004000;
		public const uint MQPMO_DEFAULT_CONTEXT = 0x00000020;
		public const uint MQPMO_PASS_IDENTITY_CONTEXT = 0x00000100;
		public const uint MQPMO_PASS_ALL_CONTEXT = 0x00000200;
		public const uint MQPMO_SET_IDENTITY_CONTEXT = 0x00000400;
		public const uint MQPMO_SET_ALL_CONTEXT = 0x00000800;
		public const uint MQPMO_ALTERNATE_USER_AUTHORITY = 0x00001000;
		public const uint MQPMO_FAIL_IF_QUIESCING = 0x00002000;
		public const uint MQPMO_NONE = 0x00000000;
		public const uint MQPMRF_MSG_ID = 1;
		public const uint MQPMRF_CORREL_ID = 2;
		public const uint MQPMRF_GROUP_ID = 4;
		public const uint MQPMRF_FEEDBACK = 8;
		public const uint MQPMRF_ACCOUNTING_TOKEN = 16;
		public const uint MQPMRF_NONE = 0;
		// open options
		public const uint MQOO_INPUT_AS_Q_DEF = 0x00000001;
		public const uint MQOO_INPUT_SHARED = 0x00000002;
		public const uint MQOO_INPUT_EXCLUSIVE = 0x00000004;
		public const uint MQOO_BROWSE = 0x00000008;
		public const uint MQOO_OUTPUT = 0x00000010;
		public const uint MQOO_INQUIRE = 0x00000020;
		public const uint MQOO_SET = 0x00000040;
		public const uint MQOO_BIND_ON_OPEN = 0x00004000;
		public const uint MQOO_BIND_NOT_FIXED = 0x00008000;
		public const uint MQOO_BIND_AS_Q_DEF = 0x00000000;
		public const uint MQOO_SAVE_ALL_CONTEXT = 0x00000080;
		public const uint MQOO_PASS_IDENTITY_CONTEXT = 0x00000100;
		public const uint MQOO_PASS_ALL_CONTEXT = 0x00000200;
		public const uint MQOO_SET_IDENTITY_CONTEXT = 0x00000400;
		public const uint MQOO_SET_ALL_CONTEXT = 0x00000800;
		public const uint MQOO_ALTERNATE_USER_AUTHORITY = 0x00001000;
		public const uint MQOO_FAIL_IF_QUIESCING = 0x00002000;
		public const uint MQOO_RESOLVE_NAMES = 0x00010000;
		// completion codes
		public const uint MQCC_OK = 0;
		public const uint MQCC_WARNING = 1;
		public const uint MQCC_FAILED = 2;
		public const uint MQCC_UNKNOWN = 0xffffffff;
		// string lengths
		public const uint MQ_ABEND_CODE_LENGTH = 4;
		public const uint MQ_ACCOUNTING_TOKEN_LENGTH = 32;
		public const uint MQ_APPL_IDENTITY_DATA_LENGTH = 32;
		public const uint MQ_APPL_NAME_LENGTH = 28;
		public const uint MQ_APPL_ORIGIN_DATA_LENGTH = 4;
		public const uint MQ_ATTENTION_ID_LENGTH = 4;
		public const uint MQ_AUTHENTICATOR_LENGTH = 8;
		public const uint MQ_BRIDGE_NAME_LENGTH = 24;
		public const uint MQ_CANCEL_CODE_LENGTH = 4;
		public const uint MQ_CF_STRUC_NAME_LENGTH = 12;
		public const uint MQ_CHANNEL_DATE_LENGTH = 12;
		public const uint MQ_CHANNEL_DESC_LENGTH = 64;
		public const uint MQ_CHANNEL_NAME_LENGTH = 20;
		public const uint MQ_CHANNEL_TIME_LENGTH = 8;
		public const uint MQ_CLUSTER_NAME_LENGTH = 48;
		public const uint MQ_CONN_NAME_LENGTH = 264;
		public const uint MQ_CONN_TAG_LENGTH = 128;
		public const uint MQ_CORREL_ID_LENGTH = 24;
		public const uint MQ_CREATION_DATE_LENGTH = 12;
		public const uint MQ_CREATION_TIME_LENGTH = 8;
		public const uint MQ_DATE_LENGTH = 12;
		public const uint MQ_EXIT_DATA_LENGTH = 32;
		public const uint MQ_EXIT_NAME_LENGTH = 128;
		public const uint MQ_EXIT_USER_AREA_LENGTH = 16;
		public const uint MQ_FACILITY_LENGTH = 8;
		public const uint MQ_FACILITY_LIKE_LENGTH = 4;
		public const uint MQ_FORMAT_LENGTH = 8;
		public const uint MQ_FUNCTION_LENGTH = 4;
		public const uint MQ_GROUP_ID_LENGTH = 24;
		public const uint MQ_LTERM_OVERRIDE_LENGTH = 8;
		public const uint MQ_LUWID_LENGTH = 16;
		public const uint MQ_MAX_EXIT_NAME_LENGTH = 128;
		public const uint MQ_MAX_MCA_USER_ID_LENGTH = 64;
		public const uint MQ_MCA_JOB_NAME_LENGTH = 28;
		public const uint MQ_MCA_NAME_LENGTH = 20;
		public const uint MQ_MCA_USER_ID_LENGTH = 64;
		public const uint MQ_MFS_MAP_NAME_LENGTH = 8;
		public const uint MQ_MODE_NAME_LENGTH = 8;
		public const uint MQ_MSG_HEADER_LENGTH = 4000;
		public const uint MQ_MSG_ID_LENGTH = 24;
		public const uint MQ_MSG_TOKEN_LENGTH = 16;
		public const uint MQ_NAMELIST_DESC_LENGTH = 64;
		public const uint MQ_NAMELIST_NAME_LENGTH = 48;
		public const uint MQ_OBJECT_INSTANCE_ID_LENGTH = 24;
		public const uint MQ_OBJECT_NAME_LENGTH = 48;
		public const uint MQ_PASSWORD_LENGTH = 12;
		public const uint MQ_PROCESS_APPL_ID_LENGTH = 256;
		public const uint MQ_PROCESS_DESC_LENGTH = 64;
		public const uint MQ_PROCESS_ENV_DATA_LENGTH = 128;
		public const uint MQ_PROCESS_NAME_LENGTH = 48;
		public const uint MQ_PROCESS_USER_DATA_LENGTH = 128;
		public const uint MQ_PUT_APPL_NAME_LENGTH = 28;
		public const uint MQ_PUT_DATE_LENGTH = 8;
		public const uint MQ_PUT_TIME_LENGTH = 8;
		public const uint MQ_Q_DESC_LENGTH = 64;
		public const uint MQ_Q_MGR_DESC_LENGTH = 64;
		public const uint MQ_Q_MGR_IDENTIFIER_LENGTH = 48;
		public const uint MQ_Q_MGR_NAME_LENGTH = 48;
		public const uint MQ_Q_NAME_LENGTH = 48;
		public const uint MQ_QSG_NAME_LENGTH = 4;
		public const uint MQ_REMOTE_SYS_ID_LENGTH = 4;
		public const uint MQ_SECURITY_ID_LENGTH = 40;
		public const uint MQ_SERVICE_NAME_LENGTH = 32;
		public const uint MQ_SERVICE_STEP_LENGTH = 8;
		public const uint MQ_SHORT_CONN_NAME_LENGTH = 20;
		public const uint MQ_START_CODE_LENGTH = 4;
		public const uint MQ_STORAGE_CLASS_LENGTH = 8;
		public const uint MQ_TIME_LENGTH = 8;
		public const uint MQ_TOTAL_EXIT_DATA_LENGTH = 999;
		public const uint MQ_TOTAL_EXIT_NAME_LENGTH = 999;
		public const uint MQ_TP_NAME_LENGTH = 64;
		public const uint MQ_TRAN_INSTANCE_ID_LENGTH = 16;
		public const uint MQ_TRANSACTION_ID_LENGTH = 4;
		public const uint MQ_TRIGGER_DATA_LENGTH = 64;
		public const uint MQ_USER_ID_LENGTH = 12;
		// structure length
		public const uint MQCD_LENGTH_4 = 1540;
		public const uint MQCD_LENGTH_5 = 1552;
		public const uint MQCD_LENGTH_6 = 1648;
		public const uint MQCD_CURRENT_LENGTH = 1648;
		// non-persistent message speed
		public const uint MQNPMS_NORMAL = 1;
		public const uint MQNPMS_FAST = 2;
		// MCA type
		public const uint MQMCAT_PROCESS = 1;
		public const uint MQMCAT_THREAD = 2;
		// data conversion
		public const uint MQCDC_SENDER_CONVERSION = 1;
		public const uint MQCDC_NO_SENDER_CONVERSION = 0;
		// put authority codes
		public const uint MQPA_DEFAULT = 1;
		public const uint MQPA_CONTEXT = 2;
		public const uint MQPA_ONLY_MCA = 3;
		public const uint MQPA_ALTERNATE_OR_MCA = 4;
		// OD version constants
		public const uint MQOD_VERSION_1									= 1;
		public const uint MQOD_VERSION_2									= 2;
		public const uint MQOD_VERSION_3									= 3;
		public const uint MQOD_CURRENT_VERSION						= 3;
		// CNO version constants
		public const uint MQCNO_VERSION_1       = 1;
		public const uint MQCNO_VERSION_2       = 2;
		public const uint MQCNO_CURRENT_VERSION = 2;
		// connect option constants
		public const uint MQCNO_STANDARD_BINDING = 0x00000000;
		public const uint MQCNO_FASTPATH_BINDING = 0x00000001;
		public const uint MQCNO_NONE             = 0x00000000;
		// object type constants
		public const uint MQOT_Q          = 1;
		public const uint MQOT_NAMELIST   = 2;
		public const uint MQOT_PROCESS    = 3;
		public const uint MQOT_Q_MGR      = 5;
		public const uint MQOT_CHANNEL    = 6;
		public const uint MQOT_RESERVED_1 = 7;
		// CD version constants
		public const uint MQCD_VERSION_1       = 1;
		public const uint MQCD_VERSION_2       = 2;
		public const uint MQCD_VERSION_3       = 3;
		public const uint MQCD_VERSION_4       = 4;
		public const uint MQCD_VERSION_5       = 5;
		public const uint MQCD_VERSION_6       = 6;
		public const uint MQCD_CURRENT_VERSION = 6;
		// channel type constants
		public const uint MQCHT_SENDER    = 1;
		public const uint MQCHT_SERVER    = 2;
		public const uint MQCHT_RECEIVER  = 3;
		public const uint MQCHT_REQUESTER = 4;
		public const uint MQCHT_ALL       = 5;
		public const uint MQCHT_CLNTCONN  = 6;
		public const uint MQCHT_SVRCONN   = 7;
		public const uint MQCHT_CLUSRCVR  = 8;
		public const uint MQCHT_CLUSSDR   = 9;
		// transport constants
		public const uint MQXPT_LOCAL   = 0;
		public const uint MQXPT_LU62    = 1;
		public const uint MQXPT_TCP     = 2;
		public const uint MQXPT_NETBIOS = 3;
		public const uint MQXPT_SPX     = 4;
		public const uint MQXPT_DECNET  = 5;
		public const uint MQXPT_UDP     = 6;
	}
	internal struct ResultCodes
	{
		public static uint MQRC_NONE                      = 0;
		public static uint MQRC_ALIAS_BASE_Q_TYPE_ERROR   = 2001;
		public static uint MQRC_ALREADY_CONNECTED         = 2002;
		public static uint MQRC_BACKED_OUT                = 2003;
		public static uint MQRC_BUFFER_ERROR              = 2004;
		public static uint MQRC_BUFFER_LENGTH_ERROR       = 2005;
		public static uint MQRC_CHAR_ATTR_LENGTH_ERROR    = 2006;
		public static uint MQRC_CHAR_ATTRS_ERROR          = 2007;
		public static uint MQRC_CHAR_ATTRS_TOO_SHORT      = 2008;
		public static uint MQRC_CONNECTION_BROKEN         = 2009;
		public static uint MQRC_DATA_LENGTH_ERROR         = 2010;
		public static uint MQRC_DYNAMIC_Q_NAME_ERROR      = 2011;
		public static uint MQRC_ENVIRONMENT_ERROR         = 2012;
		public static uint MQRC_EXPIRY_ERROR              = 2013;
		public static uint MQRC_FEEDBACK_ERROR            = 2014;
		public static uint MQRC_GET_INHIBITED             = 2016;
		public static uint MQRC_HANDLE_NOT_AVAILABLE      = 2017;
		public static uint MQRC_HCONN_ERROR               = 2018;
		public static uint MQRC_HOBJ_ERROR                = 2019;
		public static uint MQRC_INHIBIT_VALUE_ERROR       = 2020;
		public static uint MQRC_INT_ATTR_COUNT_ERROR      = 2021;
		public static uint MQRC_INT_ATTR_COUNT_TOO_SMALL  = 2022;
		public static uint MQRC_INT_ATTRS_ARRAY_ERROR     = 2023;
		public static uint MQRC_SYNCPOINT_LIMIT_REACHED   = 2024;
		public static uint MQRC_MAX_CONNS_LIMIT_REACHED   = 2025;
		public static uint MQRC_MD_ERROR                  = 2026;
		public static uint MQRC_MISSING_REPLY_TO_Q        = 2027;
		public static uint MQRC_MSG_TYPE_ERROR            = 2029;
		public static uint MQRC_MSG_TOO_BIG_FOR_Q         = 2030;
		public static uint MQRC_MSG_TOO_BIG_FOR_Q_MGR     = 2031;
		public static uint MQRC_NO_MSG_AVAILABLE          = 2033;
		public static uint MQRC_NO_MSG_UNDER_CURSOR       = 2034;
		public static uint MQRC_NOT_AUTHORIZED            = 2035;
		public static uint MQRC_NOT_OPEN_FOR_BROWSE       = 2036;
		public static uint MQRC_NOT_OPEN_FOR_INPUT        = 2037;
		public static uint MQRC_NOT_OPEN_FOR_INQUIRE      = 2038;
		public static uint MQRC_NOT_OPEN_FOR_OUTPUT       = 2039;
		public static uint MQRC_NOT_OPEN_FOR_SET          = 2040;
		public static uint MQRC_OBJECT_CHANGED            = 2041;
		public static uint MQRC_OBJECT_IN_USE             = 2042;
		public static uint MQRC_OBJECT_TYPE_ERROR         = 2043;
		public static uint MQRC_OD_ERROR                  = 2044;
		public static uint MQRC_OPTION_NOT_VALID_FOR_TYPE = 2045;
		public static uint MQRC_OPTIONS_ERROR             = 2046;
		public static uint MQRC_PERSISTENCE_ERROR         = 2047;
		public static uint MQRC_PERSISTENT_NOT_ALLOWED    = 2048;
		public static uint MQRC_PRIORITY_EXCEEDS_MAXIMUM  = 2049;
		public static uint MQRC_PRIORITY_ERROR            = 2050;
		public static uint MQRC_PUT_INHIBITED             = 2051;
		public static uint MQRC_Q_DELETED                 = 2052;
		public static uint MQRC_Q_FULL                    = 2053;
		public static uint MQRC_Q_NOT_EMPTY               = 2055;
		public static uint MQRC_Q_SPACE_NOT_AVAILABLE     = 2056;
		public static uint MQRC_Q_TYPE_ERROR              = 2057;
		public static uint MQRC_Q_MGR_NAME_ERROR          = 2058;
		public static uint MQRC_Q_MGR_NOT_AVAILABLE       = 2059;
		public static uint MQRC_REPORT_OPTIONS_ERROR      = 2061;
		public static uint MQRC_SECOND_MARK_NOT_ALLOWED   = 2062;
		public static uint MQRC_SECURITY_ERROR            = 2063;
		public static uint MQRC_SELECTOR_COUNT_ERROR      = 2065;
		public static uint MQRC_SELECTOR_LIMIT_EXCEEDED   = 2066;
		public static uint MQRC_SELECTOR_ERROR            = 2067;
		public static uint MQRC_SELECTOR_NOT_FOR_TYPE     = 2068;
		public static uint MQRC_SIGNAL_OUTSTANDING        = 2069;
		public static uint MQRC_SIGNAL_REQUEST_ACCEPTED   = 2070;
		public static uint MQRC_STORAGE_NOT_AVAILABLE     = 2071;
		public static uint MQRC_SYNCPOINT_NOT_AVAILABLE   = 2072;
		public static uint MQRC_TRIGGER_CONTROL_ERROR     = 2075;
		public static uint MQRC_TRIGGER_DEPTH_ERROR       = 2076;
		public static uint MQRC_TRIGGER_MSG_PRIORITY_ERR  = 2077;
		public static uint MQRC_TRIGGER_TYPE_ERROR        = 2078;
		public static uint MQRC_TRUNCATED_MSG_ACCEPTED    = 2079;
		public static uint MQRC_TRUNCATED_MSG_FAILED      = 2080;
		public static uint MQRC_UNKNOWN_ALIAS_BASE_Q      = 2082;
		public static uint MQRC_UNKNOWN_OBJECT_NAME       = 2085;
		public static uint MQRC_UNKNOWN_OBJECT_Q_MGR      = 2086;
		public static uint MQRC_UNKNOWN_REMOTE_Q_MGR      = 2087;
		public static uint MQRC_WAIT_INTERVAL_ERROR       = 2090;
		public static uint MQRC_XMIT_Q_TYPE_ERROR         = 2091;
		public static uint MQRC_XMIT_Q_USAGE_ERROR        = 2092;
		public static uint MQRC_NOT_OPEN_FOR_PASS_ALL     = 2093;
		public static uint MQRC_NOT_OPEN_FOR_PASS_IDENT   = 2094;
		public static uint MQRC_NOT_OPEN_FOR_SET_ALL      = 2095;
		public static uint MQRC_NOT_OPEN_FOR_SET_IDENT    = 2096;
		public static uint MQRC_CONTEXT_HANDLE_ERROR      = 2097;
		public static uint MQRC_CONTEXT_NOT_AVAILABLE     = 2098;
		public static uint MQRC_SIGNAL1_ERROR             = 2099;
		public static uint MQRC_OBJECT_ALREADY_EXISTS     = 2100;
		public static uint MQRC_OBJECT_DAMAGED            = 2101;
		public static uint MQRC_RESOURCE_PROBLEM          = 2102;
		public static uint MQRC_ANOTHER_Q_MGR_CONNECTED   = 2103;
		public static uint MQRC_UNKNOWN_REPORT_OPTION     = 2104;
		public static uint MQRC_STORAGE_CLASS_ERROR       = 2105;
		public static uint MQRC_COD_NOT_VALID_FOR_XCF_Q   = 2106;
		public static uint MQRC_XWAIT_CANCELED            = 2107;
		public static uint MQRC_XWAIT_ERROR               = 2108;
		public static uint MQRC_SUPPRESSED_BY_EXIT        = 2109;
		public static uint MQRC_FORMAT_ERROR              = 2110;
		public static uint MQRC_SOURCE_CCSID_ERROR        = 2111;
		public static uint MQRC_SOURCE_INTEGER_ENC_ERROR  = 2112;
		public static uint MQRC_SOURCE_DECIMAL_ENC_ERROR  = 2113;
		public static uint MQRC_SOURCE_FLOAT_ENC_ERROR    = 2114;
		public static uint MQRC_TARGET_CCSID_ERROR        = 2115;
		public static uint MQRC_TARGET_INTEGER_ENC_ERROR  = 2116;
		public static uint MQRC_TARGET_DECIMAL_ENC_ERROR  = 2117;
		public static uint MQRC_TARGET_FLOAT_ENC_ERROR    = 2118;
		public static uint MQRC_NOT_CONVERTED             = 2119;
		public static uint MQRC_CONVERTED_MSG_TOO_BIG     = 2120;
		public static uint MQRC_TRUNCATED                 = 2120;
		public static uint MQRC_NO_EXTERNAL_PARTICIPANTS  = 2121;
		public static uint MQRC_PARTICIPANT_NOT_AVAILABLE = 2122;
		public static uint MQRC_OUTCOME_MIXED             = 2123;
		public static uint MQRC_OUTCOME_PENDING           = 2124;
		public static uint MQRC_BRIDGE_STARTED            = 2125;
		public static uint MQRC_BRIDGE_STOPPED            = 2126;
		public static uint MQRC_ADAPTER_STORAGE_SHORTAGE  = 2127;
		public static uint MQRC_UOW_IN_PROGRESS           = 2128;
		public static uint MQRC_ADAPTER_CONN_LOAD_ERROR   = 2129;
		public static uint MQRC_ADAPTER_SERV_LOAD_ERROR   = 2130;
		public static uint MQRC_ADAPTER_DEFS_ERROR        = 2131;
		public static uint MQRC_ADAPTER_DEFS_LOAD_ERROR   = 2132;
		public static uint MQRC_ADAPTER_CONV_LOAD_ERROR   = 2133;
		public static uint MQRC_BO_ERROR                  = 2134;
		public static uint MQRC_DH_ERROR                  = 2135;
		public static uint MQRC_MULTIPLE_REASONS          = 2136;
		public static uint MQRC_OPEN_FAILED               = 2137;
		public static uint MQRC_ADAPTER_DISC_LOAD_ERROR   = 2138;
		public static uint MQRC_CNO_ERROR                 = 2139;
		public static uint MQRC_CICS_WAIT_FAILED          = 2140;
		public static uint MQRC_DLH_ERROR                 = 2141;
		public static uint MQRC_HEADER_ERROR              = 2142;
		public static uint MQRC_SOURCE_LENGTH_ERROR       = 2143;
		public static uint MQRC_TARGET_LENGTH_ERROR       = 2144;
		public static uint MQRC_SOURCE_BUFFER_ERROR       = 2145;
		public static uint MQRC_TARGET_BUFFER_ERROR       = 2146;
		public static uint MQRC_IIH_ERROR                 = 2148;
		public static uint MQRC_PCF_ERROR                 = 2149;
		public static uint MQRC_DBCS_ERROR                = 2150;
		public static uint MQRC_OBJECT_NAME_ERROR         = 2152;
		public static uint MQRC_OBJECT_Q_MGR_NAME_ERROR   = 2153;
		public static uint MQRC_RECS_PRESENT_ERROR        = 2154;
		public static uint MQRC_OBJECT_RECORDS_ERROR      = 2155;
		public static uint MQRC_RESPONSE_RECORDS_ERROR    = 2156;
		public static uint MQRC_ASID_MISMATCH             = 2157;
		public static uint MQRC_PMO_RECORD_FLAGS_ERROR    = 2158;
		public static uint MQRC_PUT_MSG_RECORDS_ERROR     = 2159;
		public static uint MQRC_CONN_ID_IN_USE            = 2160;
		public static uint MQRC_Q_MGR_QUIESCING           = 2161;
		public static uint MQRC_Q_MGR_STOPPING            = 2162;
		public static uint MQRC_DUPLICATE_RECOV_COORD     = 2163;
		public static uint MQRC_PMO_ERROR                 = 2173;
		public static uint MQRC_API_EXIT_NOT_FOUND        = 2182;
		public static uint MQRC_API_EXIT_LOAD_ERROR       = 2183;
		public static uint MQRC_REMOTE_Q_NAME_ERROR       = 2184;
		public static uint MQRC_INCONSISTENT_PERSISTENCE  = 2185;
		public static uint MQRC_GMO_ERROR                 = 2186;
		public static uint MQRC_CICS_BRIDGE_RESTRICTION   = 2187;
		public static uint MQRC_STOPPED_BY_CLUSTER_EXIT   = 2188;
		public static uint MQRC_CLUSTER_RESOLUTION_ERROR  = 2189;
		public static uint MQRC_CONVERTED_STRING_TOO_BIG  = 2190;
		public static uint MQRC_TMC_ERROR                 = 2191;
		public static uint MQRC_PAGESET_FULL              = 2192;
		public static uint MQRC_STORAGE_MEDIUM_FULL       = 2192;
		public static uint MQRC_PAGESET_ERROR             = 2193;
		public static uint MQRC_NAME_NOT_VALID_FOR_TYPE   = 2194;
		public static uint MQRC_UNEXPECTED_ERROR          = 2195;
		public static uint MQRC_UNKNOWN_XMIT_Q            = 2196;
		public static uint MQRC_UNKNOWN_DEF_XMIT_Q        = 2197;
		public static uint MQRC_DEF_XMIT_Q_TYPE_ERROR     = 2198;
		public static uint MQRC_DEF_XMIT_Q_USAGE_ERROR    = 2199;
		public static uint MQRC_NAME_IN_USE               = 2201;
		public static uint MQRC_CONNECTION_QUIESCING      = 2202;
		public static uint MQRC_CONNECTION_STOPPING       = 2203;
		public static uint MQRC_ADAPTER_NOT_AVAILABLE     = 2204;
		public static uint MQRC_MSG_ID_ERROR              = 2206;
		public static uint MQRC_CORREL_ID_ERROR           = 2207;
		public static uint MQRC_FILE_SYSTEM_ERROR         = 2208;
		public static uint MQRC_NO_MSG_LOCKED             = 2209;
		public static uint MQRC_FILE_NOT_AUDITED          = 2216;
		public static uint MQRC_CONNECTION_NOT_AUTHORIZED = 2217;
		public static uint MQRC_MSG_TOO_BIG_FOR_CHANNEL   = 2218;
		public static uint MQRC_CALL_IN_PROGRESS          = 2219;
		public static uint MQRC_RMH_ERROR                 = 2220;
		public static uint MQRC_Q_MGR_ACTIVE              = 2222;
		public static uint MQRC_Q_MGR_NOT_ACTIVE          = 2223;
		public static uint MQRC_Q_DEPTH_HIGH              = 2224;
		public static uint MQRC_Q_DEPTH_LOW               = 2225;
		public static uint MQRC_Q_SERVICE_INTERVAL_HIGH   = 2226;
		public static uint MQRC_Q_SERVICE_INTERVAL_OK     = 2227;
		public static uint MQRC_UNIT_OF_WORK_NOT_STARTED  = 2232;
		public static uint MQRC_CHANNEL_AUTO_DEF_OK       = 2233;
		public static uint MQRC_CHANNEL_AUTO_DEF_ERROR    = 2234;
		public static uint MQRC_CFH_ERROR                 = 2235;
		public static uint MQRC_CFIL_ERROR                = 2236;
		public static uint MQRC_CFIN_ERROR                = 2237;
		public static uint MQRC_CFSL_ERROR                = 2238;
		public static uint MQRC_CFST_ERROR                = 2239;
		public static uint MQRC_INCOMPLETE_GROUP          = 2241;
		public static uint MQRC_INCOMPLETE_MSG            = 2242;
		public static uint MQRC_INCONSISTENT_CCSIDS       = 2243;
		public static uint MQRC_INCONSISTENT_ENCODINGS    = 2244;
		public static uint MQRC_INCONSISTENT_UOW          = 2245;
		public static uint MQRC_INVALID_MSG_UNDER_CURSOR  = 2246;
		public static uint MQRC_MATCH_OPTIONS_ERROR       = 2247;
		public static uint MQRC_MDE_ERROR                 = 2248;
		public static uint MQRC_MSG_FLAGS_ERROR           = 2249;
		public static uint MQRC_MSG_SEQ_NUMBER_ERROR      = 2250;
		public static uint MQRC_OFFSET_ERROR              = 2251;
		public static uint MQRC_ORIGINAL_LENGTH_ERROR     = 2252;
		public static uint MQRC_SEGMENT_LENGTH_ZERO       = 2253;
		public static uint MQRC_UOW_NOT_AVAILABLE         = 2255;
		public static uint MQRC_WRONG_GMO_VERSION         = 2256;
		public static uint MQRC_WRONG_MD_VERSION          = 2257;
		public static uint MQRC_GROUP_ID_ERROR            = 2258;
		public static uint MQRC_INCONSISTENT_BROWSE       = 2259;
		public static uint MQRC_XQH_ERROR                 = 2260;
		public static uint MQRC_SRC_ENV_ERROR             = 2261;
		public static uint MQRC_SRC_NAME_ERROR            = 2262;
		public static uint MQRC_DEST_ENV_ERROR            = 2263;
		public static uint MQRC_DEST_NAME_ERROR           = 2264;
		public static uint MQRC_TM_ERROR                  = 2265;
		public static uint MQRC_CLUSTER_EXIT_ERROR        = 2266;
		public static uint MQRC_CLUSTER_EXIT_LOAD_ERROR   = 2267;
		public static uint MQRC_CLUSTER_PUT_INHIBITED     = 2268;
		public static uint MQRC_CLUSTER_RESOURCE_ERROR    = 2269;
		public static uint MQRC_NO_DESTINATIONS_AVAILABLE = 2270;
		public static uint MQRC_CONN_TAG_IN_USE           = 2271;
		public static uint MQRC_PARTIALLY_CONVERTED       = 2272;
		public static uint MQRC_CONNECTION_ERROR          = 2273;
		public static uint MQRC_OPTION_ENVIRONMENT_ERROR  = 2274;
		public static uint MQRC_CD_ERROR                  = 2277;
		public static uint MQRC_CLIENT_CONN_ERROR         = 2278;
		public static uint MQRC_CHANNEL_STOPPED_BY_USER   = 2279;
		public static uint MQRC_HCONFIG_ERROR             = 2280;
		public static uint MQRC_FUNCTION_ERROR            = 2281;
		public static uint MQRC_CHANNEL_STARTED           = 2282;
		public static uint MQRC_CHANNEL_STOPPED           = 2283;
		public static uint MQRC_CHANNEL_CONV_ERROR        = 2284;
		public static uint MQRC_SERVICE_NOT_AVAILABLE     = 2285;
		public static uint MQRC_INITIALIZATION_FAILED     = 2286;
		public static uint MQRC_TERMINATION_FAILED        = 2287;
		public static uint MQRC_UNKNOWN_Q_NAME            = 2288;
		public static uint MQRC_SERVICE_ERROR             = 2289;
		public static uint MQRC_Q_ALREADY_EXISTS          = 2290;
		public static uint MQRC_USER_ID_NOT_AVAILABLE     = 2291;
		public static uint MQRC_UNKNOWN_ENTITY            = 2292;
		public static uint MQRC_UNKNOWN_AUTH_ENTITY       = 2293;
		public static uint MQRC_UNKNOWN_REF_OBJECT        = 2294;
		public static uint MQRC_CHANNEL_ACTIVATED         = 2295;
		public static uint MQRC_CHANNEL_NOT_ACTIVATED     = 2296;
		public static uint MQRC_UOW_CANCELED              = 2297;
		public static uint MQRC_FUNCTION_NOT_SUPPORTED    = 2298;
		public static uint MQRC_SELECTOR_TYPE_ERROR       = 2299;
		public static uint MQRC_COMMAND_TYPE_ERROR        = 2300;
		public static uint MQRC_MULTIPLE_INSTANCE_ERROR   = 2301;
		public static uint MQRC_SYSTEM_ITEM_NOT_ALTERABLE = 2302;
		public static uint MQRC_BAG_CONVERSION_ERROR      = 2303;
		public static uint MQRC_SELECTOR_OUT_OF_RANGE     = 2304;
		public static uint MQRC_SELECTOR_NOT_UNIQUE       = 2305;
		public static uint MQRC_INDEX_NOT_PRESENT         = 2306;
		public static uint MQRC_STRING_ERROR              = 2307;
		public static uint MQRC_ENCODING_NOT_SUPPORTED    = 2308;
		public static uint MQRC_SELECTOR_NOT_PRESENT      = 2309;
		public static uint MQRC_OUT_SELECTOR_ERROR        = 2310;
		public static uint MQRC_STRING_TRUNCATED          = 2311;
		public static uint MQRC_SELECTOR_WRONG_TYPE       = 2312;
		public static uint MQRC_INCONSISTENT_ITEM_TYPE    = 2313;
		public static uint MQRC_INDEX_ERROR               = 2314;
		public static uint MQRC_SYSTEM_BAG_NOT_ALTERABLE  = 2315;
		public static uint MQRC_ITEM_COUNT_ERROR          = 2316;
		public static uint MQRC_FORMAT_NOT_SUPPORTED      = 2317;
		public static uint MQRC_SELECTOR_NOT_SUPPORTED    = 2318;
		public static uint MQRC_ITEM_VALUE_ERROR          = 2319;
		public static uint MQRC_HBAG_ERROR                = 2320;
		public static uint MQRC_PARAMETER_MISSING         = 2321;
		public static uint MQRC_CMD_SERVER_NOT_AVAILABLE  = 2322;
		public static uint MQRC_STRING_LENGTH_ERROR       = 2323;
		public static uint MQRC_INQUIRY_COMMAND_ERROR     = 2324;
		public static uint MQRC_NESTED_BAG_NOT_SUPPORTED  = 2325;
		public static uint MQRC_BAG_WRONG_TYPE            = 2326;
		public static uint MQRC_ITEM_TYPE_ERROR           = 2327;
		public static uint MQRC_SYSTEM_BAG_NOT_DELETABLE  = 2328;
		public static uint MQRC_SYSTEM_ITEM_NOT_DELETABLE = 2329;
		public static uint MQRC_CODED_CHAR_SET_ID_ERROR   = 2330;
		public static uint MQRC_MSG_TOKEN_ERROR           = 2331;
		public static uint MQRC_MISSING_WIH               = 2332;
		public static uint MQRC_WIH_ERROR                 = 2333;
		public static uint MQRC_RFH_ERROR                 = 2334;
		public static uint MQRC_RFH_STRING_ERROR          = 2335;
		public static uint MQRC_RFH_COMMAND_ERROR         = 2336;
		public static uint MQRC_RFH_PARM_ERROR            = 2337;
		public static uint MQRC_RFH_DUPLICATE_PARM        = 2338;
		public static uint MQRC_RFH_PARM_MISSING          = 2339;
		public static uint MQRC_CHAR_CONVERSION_ERROR     = 2340;
		public static uint MQRC_UCS2_CONVERSION_ERROR     = 2341;
		public static uint MQRC_DB2_NOT_AVAILABLE         = 2342;
		public static uint MQRC_OBJECT_NOT_UNIQUE         = 2343;
		public static uint MQRC_CONN_TAG_NOT_RELEASED     = 2344;
		public static uint MQRC_CF_NOT_AVAILABLE          = 2345;
		public static uint MQRC_CF_STRUC_IN_USE           = 2346;
		public static uint MQRC_CF_STRUC_LIST_HDR_IN_USE  = 2347;
		public static uint MQRC_CF_STRUC_AUTH_FAILED      = 2348;
		public static uint MQRC_CF_STRUC_ERROR            = 2349;
		public static uint MQRC_CONN_TAG_NOT_USABLE       = 2350;
		public static uint MQRC_GLOBAL_UOW_CONFLICT       = 2351;
		public static uint MQRC_LOCAL_UOW_CONFLICT        = 2352;
		public static uint MQRC_HANDLE_IN_USE_FOR_UOW     = 2353;
		public static uint MQRC_UOW_ENLISTMENT_ERROR      = 2354;
		public static uint MQRC_UOW_MIX_NOT_SUPPORTED     = 2355;
		public static uint MQRC_WXP_ERROR                 = 2356;
		public static uint MQRC_CURRENT_RECORD_ERROR      = 2357;
		public static uint MQRC_NEXT_OFFSET_ERROR         = 2358;
		public static uint MQRC_NO_RECORD_AVAILABLE       = 2359;
		public static uint MQRC_OBJECT_LEVEL_INCOMPATIBLE = 2360;
		public static uint MQRC_NEXT_RECORD_ERROR         = 2361;
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// helper class
	internal class MQUtils
	{
		static public byte[] StringToByteArray(string stringValue,int length)
		{
			byte[] result = new byte[length];
			Encoding.ASCII.GetBytes(stringValue,0,stringValue.Length,result,0);
			return result;
		}
		static public byte[] StringToByteArray(string stringValue,uint length)
		{
			byte[] result = new byte[length];
			Encoding.ASCII.GetBytes(stringValue,0,stringValue.Length,result,0);
			return result;
		}
		static public byte[] EmptyByteArray(int length)
		{
			byte[] result = new byte[length];
			return result;
		}
	}
	//////////////////////////////////////////////////////////////////////////////////////
	// MQBUFFER structure - large buffer for binary data
	[StructLayout(LayoutKind.Sequential)]
	internal class MQBUFFER
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=80000)] public byte[] _Buffer;
		public MQBUFFER()
		{
			_Buffer = MQUtils.EmptyByteArray(80000);
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// MQNAME structure - queue name
	[StructLayout(LayoutKind.Sequential)]
	internal class MQNAME
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _QueueName;
		public MQNAME(string name)
		{
			_QueueName = MQUtils.StringToByteArray(name,48);
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// MQRR structure - response record
	[StructLayout(LayoutKind.Sequential)]
	internal class MQRR
	{
		public uint		_CompCode = 0;
		public uint		_Reason = 0;
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// MQOR structure - object record
	[StructLayout(LayoutKind.Sequential)]
	internal class MQOR
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ObjectName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ObjectQMgrName;
		public MQOR()
		{
			_ObjectName = MQUtils.EmptyByteArray(48);
			_ObjectQMgrName = MQUtils.EmptyByteArray(48);
		}
		public MQOR(string name,string qmgrname)
		{
			_ObjectName = MQUtils.StringToByteArray(name,48);
			_ObjectQMgrName = MQUtils.StringToByteArray(qmgrname,48);
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// MQOD structure - object descriptor
	[StructLayout(LayoutKind.Sequential)]
	internal class MQOD
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=4)]	public byte[] _StrucID;
		public uint		_Version;
		public uint		_ObjectType;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ObjectName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ObjectQMgrName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _DynamicQName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=12)] public byte[] _AlternateUserId;
		public uint		_RecsPresent;
		public uint		_KnownDestCount;
		public uint		_UnknownDestCount;
		public uint		_InvalidDestCount;
		public uint		_ObjectRecOffset;
		public uint		_ResponseRecOffset;
		public IntPtr	_ObjectRecPtr;		// MQOR
		public IntPtr	_ResponseRecPtr;	// MQRR
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=40)] public byte[] _AlternateSecurityId;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ResolvedQName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ResolvedQMgrName;
		// following attributes are not part of MQ structure
		public MQOR	_ObjectRec;
		public MQRR	_ResponseRec;
		///////////////////////////////////////////////////////////
		// constructor
		public MQOD()
		{
			_StrucID = MQUtils.StringToByteArray("OD  ",4);
			_Version = Constants.MQOD_VERSION_1;
			_ObjectType = Constants.MQOT_Q;
			_ObjectName = MQUtils.StringToByteArray("",48);
			_ObjectQMgrName = MQUtils.StringToByteArray("",48);
			_DynamicQName = MQUtils.StringToByteArray("AMQ.*",48);
			_AlternateUserId = MQUtils.StringToByteArray("",12);
			_RecsPresent = 0;
			_KnownDestCount = 0;
			_UnknownDestCount = 0;
			_InvalidDestCount = 0;
			_ObjectRecOffset = 0;
			_ResponseRecOffset = 0;
			_ObjectRecPtr = new IntPtr(0);
			_ResponseRecPtr = new IntPtr(0);
			_AlternateSecurityId = new byte[40];
			_ResolvedQName = MQUtils.StringToByteArray("",48);
			_ResolvedQMgrName = MQUtils.StringToByteArray("",48);
			_ObjectRec = new MQOR();
			_ResponseRec = new MQRR();
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// MQPMO structure - put message options
	[StructLayout(LayoutKind.Sequential)]
	internal class MQPMO
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=4)] public byte[] _StrucId;
		public uint			_Version;
		public uint			_Options;
		public uint			_Timeout;
		public uint			_Context;
		public uint			_KnownDestCount;
		public uint			_UnknownDestCount;
		public uint			_InvalidDestCount;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ResolvedQName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ResolvedQMgrName;
		public uint			_RecsPresent;
		public uint			_PutMsgRecFields;
		public uint			_PutMsgRecOffset;
		public uint			_ResponseRecOffset;
		public IntPtr		_PutMsgRecPtr;
		public IntPtr		_ResponseRecPtr;
		///////////////////////////////////////////////////////////
		// constructor
		public MQPMO()
		{
			_StrucId = MQUtils.StringToByteArray("PMO ",4);
			_Version = Constants.MQPMO_VERSION_1;
			_Options = Constants.MQPMO_NONE;
			_Timeout = 0xffffffff;
			_Context = 0;
			_KnownDestCount = 0;
			_UnknownDestCount = 0;
			_InvalidDestCount = 0;
			_ResolvedQName = MQUtils.EmptyByteArray(48);
			_ResolvedQMgrName = MQUtils.EmptyByteArray(48);
			_RecsPresent = 0;
			_PutMsgRecFields = Constants.MQPMRF_NONE;
			_PutMsgRecOffset = 0;
			_ResponseRecOffset = 0;
			_PutMsgRecPtr = new IntPtr(0);
			_ResponseRecPtr = new IntPtr(0);
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// MQGMO structure - message descriptor
	[StructLayout(LayoutKind.Sequential)]
	internal class MQGMO
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=4)] public byte[] _StrucId;
		public uint			_Version;
		public uint			_Options;
		public uint			_WaitInterval;
		public uint			_Signal1;
		public uint			_Signal2;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ResolvedQName;
		public uint			_MatchOptions;
		public byte			_GroupStatus;
		public byte			_SegmentStatus;
		public byte			_Segmentation;
		public byte			_Reserved1;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=16)] public byte[] _MsgToken;
		public uint			_ReturnedLength;
		///////////////////////////////////////////////////////////
		// constructor
		public MQGMO()
		{
			_StrucId = MQUtils.StringToByteArray("GMO ",4);
			_Version = Constants.MQGMO_VERSION_1;
			_Options = Constants.MQGMO_NO_WAIT;
			_WaitInterval = 0;
			_Signal1 = 0;
			_Signal2 = 0;
			_ResolvedQName = MQUtils.EmptyByteArray(48);
			_MatchOptions = Constants.MQMO_MATCH_MSG_ID | Constants.MQMO_MATCH_CORREL_ID;
			_GroupStatus = Constants.MQGS_NOT_IN_GROUP;
			_SegmentStatus = Constants.MQSS_NOT_A_SEGMENT;
			_Segmentation = Constants.MQSEG_INHIBITED;
			_Reserved1 = (byte)' ';
			_MsgToken = MQUtils.EmptyByteArray(16);
			_ReturnedLength = Constants.MQRL_UNDEFINED;
		}
	}	
	///////////////////////////////////////////////////////////////////////////////////////
	// MQMD structure - message descriptor
	[StructLayout(LayoutKind.Sequential)]
	internal class MQMD
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=4)] public byte[] _StrucId;
		public uint			_Version;                   
		public uint			_Report;               
		public uint			_MsgType;             
		public uint			_Expiry;             
		public uint			_Feedback;
		public uint			_Encoding;
		public uint			_CodedCharSetId;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=8)] public byte[] _Format;
		public uint			_Priority;
		public uint			_Persistence;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=24)] public byte[] _MsgId;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=24)] public byte[] _CorrelId;
		public uint			_BackoutCount;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ReplyToQ;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _ReplyToQMgr;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=12)] public byte[] _UserIdentifier;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] public byte[] _AccountingToken;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] public byte[] _ApplIdentityData;
		public uint			_PutApplType;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=28)] public byte[] _PutApplName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=8)] public byte[] _PutDate;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=8)] public byte[] _PutTime;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=4)] public byte[] _ApplOriginData;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=24)] public byte[] _GroupId;
		public uint			_MsgSeqNumber;
		public uint			_Offset;
		public uint			_MsgFlags;
		public uint			_OriginalLength;
		///////////////////////////////////////////////////////////
		// constructor
		public MQMD()
		{
			_StrucId = MQUtils.StringToByteArray("MD  ",4);
			_Version = Constants.MQMD_VERSION_1;
			_Report = Constants.MQRO_NONE;
			_MsgType = Constants.MQMT_DATAGRAM;
			_Expiry = Constants.MQEI_UNLIMITED;
			_Feedback = Constants.MQFB_NONE;
			_Encoding = Constants.MQENC_NATIVE;
			_CodedCharSetId = Constants.MQCCSI_Q_MGR;
			_Format = MQUtils.StringToByteArray("        ",8);
			_Priority = Constants.MQPRI_PRIORITY_AS_Q_DEF;
			_Persistence = Constants.MQPER_PERSISTENCE_AS_Q_DEF;
			_MsgId = MQUtils.EmptyByteArray(24);
			_CorrelId = MQUtils.EmptyByteArray(24);
			_BackoutCount = 0;
			_ReplyToQ = MQUtils.EmptyByteArray(48);
			_ReplyToQMgr = MQUtils.EmptyByteArray(48);
			_UserIdentifier = MQUtils.EmptyByteArray(12);
			_AccountingToken = MQUtils.EmptyByteArray(32);
			_ApplIdentityData = MQUtils.EmptyByteArray(32);
			_PutApplType = Constants.MQAT_NO_CONTEXT;
			_PutApplName = MQUtils.EmptyByteArray(28);
			_PutDate = MQUtils.EmptyByteArray(8);
			_PutTime = MQUtils.EmptyByteArray(8);
			_ApplOriginData = MQUtils.EmptyByteArray(4);
			_GroupId = MQUtils.EmptyByteArray(24);
			_MsgSeqNumber = 1;
			_Offset = 0;
			_MsgFlags = Constants.MQMF_NONE;
			_OriginalLength = Constants.MQOL_UNDEFINED;
		}
	}
	//////////////////////////////////////////////////////////////////////////////////////
	// MQCD structure - connection description
	[StructLayout(LayoutKind.Sequential)]
	internal class MQCD
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=20)] public byte[] _ChannelName;
		public uint			_Version;                   
		public uint			_ChannelType;               
		public uint			_TransportType;             
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=64)] public byte[] _Desc;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _QMgrName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=48)] public byte[] _XmitQName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=20)] public byte[] _ShortConnectionName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=20)] public byte[] _MCAName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=8)] public byte[] _ModeName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=64)] public byte[] _TpName;
		public uint			_BatchSize;                 
		public uint			_DiscInterval;              
		public uint			_ShortRetryCount;           
		public uint			_ShortRetryInterval;        
		public uint			_LongRetryCount;            
		public uint			_LongRetryInterval;         
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=128)] public byte[] _SecurityExit;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=128)] public byte[] _MsgExit;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=128)] public byte[] _SendExit;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=128)]	public byte[] _ReceiveExit;
		public uint			_SeqNumberWrap;             
		public uint			_MaxMsgLength;              
		public uint			_PutAuthority;              
		public uint			_DataConversion;            
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] public byte[] _SecurityUserData;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] public byte[] _MsgUserData;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] public byte[] _SendUserData;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] public byte[] _ReceiveUserData;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=12)] public byte[] _UserIdentifier;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=12)] public byte[] _Password;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=12)] public byte[] _MCAUserIdentifier;
		public uint			_MCAType;                   
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=264)] public byte[] _ConnectionName;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=12)] public byte[] _RemoteUserIdentifier;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=12)] public byte[] _RemotePassword;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=128)] public byte[] _MsgRetryExit;
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] public byte[] _MsgRetryUserData;
		public uint			_MsgRetryCount;             
		public uint			_MsgRetryInterval;          
		public uint			_HeartbeatInterval;         
		public uint			_BatchInterval;             
		public uint			_NonPersistentMsgSpeed;     
		public uint			_StrucLength;               
		public uint			_ExitNameLength;            
		public uint			_ExitDataLength;            
		public uint			_MsgExitsDefined;           
		public uint			_SendExitsDefined;          
		public uint			_ReceiveExitsDefined;       
		public IntPtr		_MsgExitPtr;                
		public IntPtr		_MsgUserDataPtr;            
		public IntPtr		_SendExitPtr;               
		public IntPtr		_SendUserDataPtr;           
		public IntPtr		_ReceiveExitPtr;            
		public IntPtr		_ReceiveUserDataPtr;        
		public IntPtr		_ClusterPtr;                
		public uint							_ClustersDefined;           
		public uint							_NetworkPriority;           
		public uint							_LongMCAUserIdLength;       
		public uint							_LongRemoteUserIdLength;    
		public IntPtr		_LongMCAUserIdPtr;          
		public IntPtr		_LongRemoteUserIdPtr;       
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=40)] public byte[] _MCASecurityId;             
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=40)] public byte[] _RemoteSecurityId;          
		///////////////////////////////////////////////////////////
		// constructor
		public MQCD()
		{
			_ChannelName = MQUtils.EmptyByteArray(20);
			_Version = Constants.MQCD_VERSION_5;
			_ChannelType = Constants.MQCHT_CLNTCONN;
			_TransportType = Constants.MQXPT_TCP;
			_Desc = MQUtils.EmptyByteArray(64);
			_QMgrName = MQUtils.EmptyByteArray(48);
			_XmitQName = MQUtils.EmptyByteArray(48);
			_ShortConnectionName = MQUtils.EmptyByteArray(20);
			_MCAName = MQUtils.EmptyByteArray(20);
			_ModeName = MQUtils.EmptyByteArray(8);
			_TpName = MQUtils.EmptyByteArray(64);
			_BatchSize = 50;
			_DiscInterval = 6000;
			_ShortRetryCount = 10;
			_ShortRetryInterval = 60;
			_LongRetryCount = 999999999;
			_LongRetryInterval = 1200;
			_SecurityExit = MQUtils.EmptyByteArray(128);
			_MsgExit = MQUtils.EmptyByteArray(128);
			_SendExit = MQUtils.EmptyByteArray(128);
			_ReceiveExit = MQUtils.EmptyByteArray(128);
			_SeqNumberWrap = 999999999;
			_MaxMsgLength = 4194304;
			_PutAuthority = Constants.MQPA_DEFAULT;
			_DataConversion = Constants.MQCDC_NO_SENDER_CONVERSION;
			_SecurityUserData = MQUtils.EmptyByteArray(32);
			_MsgUserData = MQUtils.EmptyByteArray(32);
			_SendUserData = MQUtils.EmptyByteArray(32);
			_ReceiveUserData = MQUtils.EmptyByteArray(32);
			_UserIdentifier = MQUtils.EmptyByteArray(12);
			_Password = MQUtils.EmptyByteArray(12);
			_MCAUserIdentifier = MQUtils.EmptyByteArray(12);
			_MCAType = Constants.MQMCAT_PROCESS;
			_ConnectionName = MQUtils.EmptyByteArray(264);
			_RemoteUserIdentifier = MQUtils.EmptyByteArray(12);
			_RemotePassword = MQUtils.EmptyByteArray(12);
			_MsgRetryExit = MQUtils.EmptyByteArray(128);
			_MsgRetryUserData = MQUtils.EmptyByteArray(32);
			_MsgRetryCount = 10;
			_MsgRetryInterval = 1000;
			_HeartbeatInterval = 1;
			_BatchInterval = 0;
			_NonPersistentMsgSpeed = Constants.MQNPMS_FAST;
			_StrucLength = Constants.MQCD_LENGTH_6;
			_ExitNameLength = Constants.MQ_EXIT_NAME_LENGTH;
			_ExitDataLength = Constants.MQ_EXIT_DATA_LENGTH;
			_MsgExitsDefined = 0;
			_SendExitsDefined = 0;
			_ReceiveExitsDefined = 0;
			_MsgExitPtr = new IntPtr(0);
			_MsgUserDataPtr = new IntPtr(0);
			_SendExitPtr = new IntPtr(0);
			_SendUserDataPtr = new IntPtr(0);
			_ReceiveExitPtr = new IntPtr(0);
			_ReceiveUserDataPtr = new IntPtr(0);
			_ClusterPtr = new IntPtr(0);
			_ClustersDefined = 0;
			_NetworkPriority = 0;
			_LongMCAUserIdLength = 0;
			_LongRemoteUserIdLength = 0;
			_LongMCAUserIdPtr = new IntPtr(0);
			_LongRemoteUserIdPtr =  new IntPtr(0);
			_MCASecurityId = MQUtils.EmptyByteArray(40);
			_RemoteSecurityId = MQUtils.EmptyByteArray(40);
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////
	// MQCNO structure - connect options
	[StructLayout(LayoutKind.Sequential)]
	internal class MQCNO
	{
		[MarshalAs( UnmanagedType.ByValArray, SizeConst=4)]	public byte[] _StrucID;
		public uint		_Version;
		public uint		_Options;
		public uint		_ClientConnOffset;
		public IntPtr	_ClientConnPtr;
			///////////////////////////////////////////////////////////
		// constructor
		public MQCNO()
		{
			_StrucID = MQUtils.StringToByteArray("CNO ",4);
			_Version = Constants.MQCNO_VERSION_1;
			_Options = Constants.MQCNO_NONE;
			_ClientConnOffset = 0;
			_ClientConnPtr = new IntPtr(0);
		}
	}
}
